package org.wzl.service.utils;

import jakarta.servlet.http.HttpServletResponse;
import lombok.Builder;

import java.io.IOException;

/**
 * @author: 卫志龙
 * @date: 2024年06月28日 23:41
 */
public class HttpResponseUtil {

    public static void sendResp(Response response) throws IOException {
        response.httpServletResponse.setStatus(response.responseEntity.getCode());
        response.httpServletResponse.setContentType("application/json");
        response.httpServletResponse.setCharacterEncoding("utf-8");
        response.httpServletResponse.getWriter().print(JsonWrapUtil.toJsonString(response.responseEntity.getMsg()));
    }

    @Builder
    public static class Response {
        private HttpServletResponse httpServletResponse;
        private Resp<?> responseEntity;
    }

}
